<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>3 事件修饰符</title>
  </head>
  <body>
    <div id="app">
      <h3>v-model 修饰符 .trim .number</h3>
      姓名：<input type="text" v-model.trim="username" /> <br />
      年龄：<input type="text" v-model.number="age" />

      <h3>@事件名 .stop ->阻止冒泡</h3>
      <div @click="fatherFn" class="father">
        <div @click.stop="sonFn" class="son">儿子</div>
      </div>

      <h3>@事件名 .prevent ->阻止默认行为</h3>
      <a @click.prevent href="https://www.baidu.com">百度</a>

      <!-- <h3>v-on 修饰符 .stop .prevent .capture .self .once</h3>
    <div @click="handleClick">
      <a href="https://www.baidu.com">baidu</a>
    </div> -->
    </div>

    <script src="../js/vue.js"></script>
    <script>
      var app = new Vue({
        el: "#app",
        data: {
          username: "",
          age: "",
        },
        methods: {
          fatherFn(){
            alert('父亲被点击');
          },
          sonFn(){
            alert('儿子被点击');
          }
        },
      });
    </script>

    <style>
      .father {
        width: 200px;
        height: 200px;
        background-color: pink;
      }
      .son {
        width: 100px;
        height: 100px;
        background-color: red;
      }
    </style>
  </body>
</html>
